/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "hos_pedido_dieta")
@NamedQueries({
    @NamedQuery(name = "HosPedidoDieta.findAll", query = "SELECT h FROM HosPedidoDieta h")})
public class HosPedidoDieta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "hpd_id")
    private Integer hpdId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hpd_hora")
    @Temporal(TemporalType.TIME)
    private Date hpdHora;
    @Column(name = "hpd_num_biberones")
    private Integer hpdNumBiberones;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hpd_id_usuario")
    private int hpdIdUsuario;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "hpd_nombre_usuario")
    private String hpdNombreUsuario;
    @JoinTable(name = "hos_pedido_tipo_dieta", joinColumns = {
        @JoinColumn(name = "hpd_id", referencedColumnName = "hpd_id")}, inverseJoinColumns = {
        @JoinColumn(name = "htd_id", referencedColumnName = "htd_id")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<HosTipoDieta> hosTipoDietaList;
    @JoinColumn(name = "hin_id", referencedColumnName = "hin_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private HosInternacion hosInternacion;

    public HosPedidoDieta() {
    }

    public HosPedidoDieta(Integer hpdId) {
        this.hpdId = hpdId;
    }

    public HosPedidoDieta(Integer hpdId, Date hpdHora, int hpdIdUsuario, String hpdNombreUsuario) {
        this.hpdId = hpdId;
        this.hpdHora = hpdHora;
        this.hpdIdUsuario = hpdIdUsuario;
        this.hpdNombreUsuario = hpdNombreUsuario;
    }

    public Integer getHpdId() {
        return hpdId;
    }

    public void setHpdId(Integer hpdId) {
        this.hpdId = hpdId;
    }

    public Date getHpdHora() {
        return hpdHora;
    }

    public void setHpdHora(Date hpdHora) {
        this.hpdHora = hpdHora;
    }

    public Integer getHpdNumBiberones() {
        return hpdNumBiberones;
    }

    public void setHpdNumBiberones(Integer hpdNumBiberones) {
        this.hpdNumBiberones = hpdNumBiberones;
    }

    public int getHpdIdUsuario() {
        return hpdIdUsuario;
    }

    public void setHpdIdUsuario(int hpdIdUsuario) {
        this.hpdIdUsuario = hpdIdUsuario;
    }

    public String getHpdNombreUsuario() {
        return hpdNombreUsuario;
    }

    public void setHpdNombreUsuario(String hpdNombreUsuario) {
        this.hpdNombreUsuario = hpdNombreUsuario;
    }

    public List<HosTipoDieta> getHosTipoDietaList() {
        return hosTipoDietaList;
    }

    public void setHosTipoDietaList(List<HosTipoDieta> hosTipoDietaList) {
        this.hosTipoDietaList = hosTipoDietaList;
    }

    public HosInternacion getHosInternacion() {
        return hosInternacion;
    }

    public void setHosInternacion(HosInternacion hosInternacion) {
        this.hosInternacion = hosInternacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hpdId != null ? hpdId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HosPedidoDieta)) {
            return false;
        }
        HosPedidoDieta other = (HosPedidoDieta) object;
        if ((this.hpdId == null && other.hpdId != null) || (this.hpdId != null && !this.hpdId.equals(other.hpdId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.HosPedidoDieta[ hpdId=" + hpdId + " ]";
    }
    
}
